package cn.edu.neu.springbootdemo.mapper

import cn.edu.neu.springbootdemo.model.Goods
import org.apache.ibatis.annotations.*
import java.util.*

@Mapper
interface GoodsMapper {
    @Select("select * from shop")
    fun getGoods(): ArrayList<Goods>

    @Delete("delete from shop where shop_id = #{id}")
    fun delGoods(id: Int?): Boolean

    @Insert("insert into shop(shop_id,shop_name,shop_price,shop_pic,remain,shop_type) values(#{id},#{name},#{price},#{pic},#{remain},#{type})")
    fun addGoods(id: Int,name: String,price: String,pic: String,remain: String,type: String):Boolean

    @Select("select * from shop where shop_name like CONCAT('%',#{name},'%') ")
    fun findGoods(name: String?): ArrayList<Goods>

    @Update("update shop set shop_name=#{name},shop_price=#{price},remain=#{remain},shop_type=#{type} where shop_id=#{id}")
    fun changeGoods(id: Int,name: String,price: String,remain: String,type: String):Boolean
}